package utils;

import java.io.IOException;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Created by wuwei on 16/9/11.
 */

public class Okhttputils {
    private Okhttputils() {
    }

    private static Okhttputils OK = new Okhttputils();

    //静态工厂方法
    public static Okhttputils getInstance() {
        return OK;
    }

    OkHttpClient client = new OkHttpClient();

    public String run(String url) throws IOException {
        Request request = new Request.Builder()
                .url(url)
                .addHeader("x-android","19")
                .addHeader("x-content"," 22baa6020ec105901a61a1a90662c3e7_4167b759c161b1249d28c3542a0af0eb")
                .addHeader("x-nanyibang","2.4.0")
                .build();

        Response response = client.newCall(request).execute();
        return response.body().string();
    }
}
